package daoImpl;

import dao.userDao;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import pojo.User;
/*
所以我的实现类不一定要继承SqlSessionDaoSupport，继承有什么好处？
 */
public class userDaoImpl2  implements userDao {

    private SqlSessionFactory sqlSessionFactory;

    public User getUserById(Integer id) {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        User user = sqlSession.selectOne("getUserById",id);
        return user;
    }

    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }
}
